package com.fucius.study.leetcode;

public class MaximumXor {

    public int[] getMaximumXor(int[] nums, int maximumBit) {
        int[] dp = new int[nums.length];
        dp[0] = nums[0];
        for (int i = 1; i < nums.length; i++) {
            dp[i] = dp[i-1]^nums[i];
        }
        int temp = (1<<maximumBit) -1;
        int j=0;
        for (int i = dp.length - 1; i >= 0; i--) {
            nums[j++] = dp[i]^temp;
        }

        return nums;
    }

    public static void main(String[] args) {

        System.out.println(new MaximumXor().getMaximumXor(new int[]{},2));
    }
}
